<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>后台模板</title>
		<link rel="stylesheet" href="../assets/css/amazeui.css" />
		<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
		<link rel="stylesheet" href="../assets/css/core.css" />
		<link rel="stylesheet" href="../assets/css/menu.css" />
		<link rel="stylesheet" href="../assets/css/index.css" />
		<link rel="stylesheet" href="../assets/css/admin.css" />
		<link rel="stylesheet" href="../assets/css/page/typography.css" />
		<link rel="stylesheet" href="../assets/css/page/form.css" />
	</head>
	<body>
		<header class="am-topbar am-topbar-fixed-top">		
			<div class="am-topbar-left am-hide-sm-only">
                <a href="" class="logo"><span>欢迎你</span><i class="zmdi zmdi-layers"></i></a>
            </div>
	
			<div class="contain">
				<ul class="am-nav am-navbar-nav am-navbar-left">

					<li><h4 class="page-title">个人信息</h4></li>
				</ul>
				
				<ul class="am-nav am-navbar-nav am-navbar-right">
					<li class="hidden-xs am-hide-sm-only">
                        <form role="search" class="app-search">
                            <td><button class="label label-danger" onclick='loginout()'>退出登录</span></td>
                        </form>
                    </li>
				</ul>
			</div>
		</header>
		<!-- end page -->
		
		
		<div class="admin">
			<!--<div class="am-g">-->
		<!-- ========== Left Sidebar Start ========== -->
		<!--<div class="left side-menu am-hide-sm-only am-u-md-1 am-padding-0">
			<div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 548px;">
				<div class="sidebar-inner slimscrollleft" style="overflow: hidden; width: auto; height: 548px;">-->
                  <!-- sidebar start -->
				  <div class="admin-sidebar am-offcanvas  am-padding-0" id="admin-offcanvas">
				    <div class="am-offcanvas-bar admin-offcanvas-bar">
				    	<!-- User -->
						<div class="user-box am-hide-sm-only">
	                        <div class="user-img">
	                            <img src="../assets/img/avatar-1.png" alt="user-img" title="Mat Helme" class="img-circle img-thumbnail img-responsive">
	                            <div class="user-status offline"><i class="am-icon-dot-circle-o" aria-hidden="true"></i></div>
	                        </div>
	                        <h5 id="user"><a href="#"></a> </h5>
	                        <ul class="list-inline">
	                            <li>
	                                <a href="#">
	                                    <i class="fa fa-cog" aria-hidden="true"></i>
	                                </a>
	                            </li>
	
	                            <li>
	                                <a href="#" class="text-custom">
	                                    <i class="fa fa-cog" aria-hidden="true"></i>
	                                </a>
	                            </li>
	                        </ul>
	                    </div>
	                    <!-- End User -->
	            
						 <ul class="am-list admin-sidebar-list">
							<li><a href="../html/persondetails.html"><span class="am-icon-home"></span> 个人信息</a></li>
						    <li class="admin-parent">
						      <a class="am-cf" data-am-collapse="{target: '#collapse-nav5'}"><span class="am-icon-file"></span> 工单模块 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
						      <ul class="am-list am-collapse admin-sidebar-sub am-in" id="collapse-nav5">
						      	<li><a href="../html/user_job.html" > 历史工单</a></li>
						        <li><a href="../html/user_evaluate.html" > 评价工单</a></li>
						        <li><a href="../html/user_validate.html">故障下单</a></li> 
						        <li><a href="../html/user_position.html">地址管理</a></li>  
						        <li><a href="../html/user_cancle.html">取消工单</a></li>
						      </ul>
						    </li>
						  </ul>
				</div>
				  </div>
				  <!-- sidebar end -->
    
				<!--</div>
			</div>
		</div>-->
		<!-- ========== Left Sidebar end ========== -->
		
		
		
	<!--	<div class="am-g">-->
		<!-- ============================================================== -->
		<!-- Start right Content here -->
		<div class="content-page">
			<!-- Start content -->
			<div class="content">
				<div class="am-g">
					<!-- Row start -->
						<div class="am-u-sm-12">
							<div class="card-box">
								<form action="" class="am-form" data-am-validator>
								  <!-- <fieldset> -->
								  	<div class="am-form-group" style="display:none" >
								      <label for="doc-vld-name-2">id：</label>
								      <input type="text" id="doc-vld-id" class="id" />
								    </div>
								    
								    <div class="am-form-group">
								      <label for="doc-vld-name-2">登录名：</label>
								      <input type="text" id="doc-vld-loginname" class="loginname" />
								    </div>
								    <div class="am-form-group">
								      <label for="doc-vld-name-2">姓名：</label>
								      <input type="text" id="doc-vld-name" class="username" />
								    </div>
								    
								    <div class="am-form-group">
								      <label for="doc-vld-name-2">密码：</label>
								      <input type="password" id="doc-vld-password" class="password" />
								    </div>
								
								    <div class="am-form-group">
								      <label for="doc-vld-email-2">手机号码：</label>
								      <input type="text" id="doc-vld-phone" class="phone" />
								    </div>
									
									<div class="am-form-group">
								      <label for="doc-vld-email-2">年龄：</label>
								      <input type="text" id="doc-vld-age" class="age" />
								    </div>
								
									<div class="am-form-group">
								      <label for="doc-vld-email-2">备注：</label>
								      <input type="text" id="doc-vld-remarks" class="remarks" />
								    </div>
								
								    <button class="am-btn am-btn-secondary" type="button" onclick='sumbit()'>修改</button>
								  <!-- </fieldset> -->
								</form>
								
								
							</div>
						</div>
					<!-- Row end -->
				</div>
			
			
			
			
			</div>
		</div>
		<!-- end right Content here -->
		<!--</div>-->
		</div>
		</div>
		
		<!-- navbar -->
		<a href="admin-offcanvas" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"><!--<i class="fa fa-bars" aria-hidden="true"></i>--></a>
		
		
		<script type="text/javascript" src="../assets/js/jquery-2.1.0.js" ></script>
		<script type="text/javascript" src="../assets/js/amazeui.min.js"></script>
		<script type="text/javascript" src="../assets/js/app.js" ></script>
		<script type="text/javascript" src="../assets/js/blockUI.js" ></script>
		<script type="text/javascript">
			//获得当前用户
			$.ajax({
				type:"post",
				url : "../User/getUser",//路径 
			    contentType : "application/json;charset=UTF-8",
			    dataType:"Json",
			    async:true,
			    success : function(res){
			    	if(res.info == "success"){
			    		var data = res.object;
			    		$(".id").val(data.id);
			    		$(".loginname").val(data.login_name);
			    		$(".username").val(data.real_name);
			    		$(".phone").val(data.phone);
			    		$(".password").val(data.password);
			    		$(".age").val(data.age);
			    		$(".remarks").val(data.remarks);
			    		$("#user").html(data.real_name);
			    	}else{
			    		window.location.href = "../login.jsp" 
			    	}
			    }
			});
			
			var  sumbit =function(){
				var id = $(".id").val();
				var login_name = $(".loginname").val();
				var real_name = $(".username").val();
				var phone = $(".phone").val();
				var password = $(".password").val();
				var age = $(".age").val();
				var remarks = $(".remarks").val();
				//新增故障单
				$.ajax({
					type:"post",
					url : "../User/updateUser",//路径 
				    data:{id:id,login_name:login_name,real_name:real_name,phone:phone,password:password,age:age,remarks:remarks},
				    dataType:"Json",
				    success : function(res){
				    	if(res.info == "success"){
				    		alert("修改成功");
				    	}
				    }
				});
			};
			
			
			var loginout = function(){
				
				var num = 1;
				$.ajax({
					type:"post",
					url : "../login/loginout",//路径 
				    data:{num:num},
				    dataType:"Json",
				    async:true,
				    success : function(res){
				    	if(res.info == "success"){
				    		window.location.href = "../login.jsp" 
				    		console.log(res.info) 
				    	}
				    }
				})
			}
		</script>
	</body>
	
</html>
